package com.example.demo.listener;


import com.example.demo.service.SseService;
import jakarta.annotation.Resource;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class MyEventHandler {

    @Resource
    private SseService service;
    @EventListener
    public void event(MyEvent event) throws IOException {
        System.out.println(event.getClientId()+event.getParam());
        service.send(event.getClientId(),event.getParam());
    }
}